<?php

/**
 * Shop form base class.
 *
 * @method Shop getObject() Returns the current form's model object
 *
 * @package    explications_informatiques
 * @subpackage form
 * @author     Guimezanes Cyrille
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseShopForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'nom'              => new sfWidgetFormInputText(),
      'description'      => new sfWidgetFormTextarea(),
      'prix'             => new sfWidgetFormInputText(),
      'img'              => new sfWidgetFormInputText(),
      'online'           => new sfWidgetFormChoice(array('choices' => array(0 => '0', 1 => '1'))),
      'function_to_call' => new sfWidgetFormInputText(),
      'argument'         => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nom'              => new sfValidatorString(array('max_length' => 200)),
      'description'      => new sfValidatorString(),
      'prix'             => new sfValidatorInteger(),
      'img'              => new sfValidatorString(array('max_length' => 150)),
      'online'           => new sfValidatorChoice(array('choices' => array(0 => '0', 1 => '1'), 'required' => false)),
      'function_to_call' => new sfValidatorString(array('max_length' => 100)),
      'argument'         => new sfValidatorString(array('max_length' => 100)),
    ));

    $this->widgetSchema->setNameFormat('shop[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Shop';
  }

}
